<template>
  <div>
      <el-row class="main-media-body">
        <el-col :span="media_left">
          <el-row class="main-media-title">{{msg.title}}</el-row>
          <el-row class="main-media-content">{{msg.desc}}</el-row>

        </el-col>

        <el-col :span="media_right">
          <el-image
              class="media-img"
              style="width: 165px; height: 100px"
              :src="msg.img"
              :fit="'cover'">
          </el-image>
        </el-col>

      </el-row>

    <el-row class=" main-media-body main-media-status">
      <span><i class="el-icon-user"></i>{{msg.auth}}</span>
      <span><i class="el-icon-s-comment"></i>{{msg.comments}}</span>
      <span><i class="el-icon-star-on"></i>{{msg.like}}</span>
    </el-row>


    <el-divider/>
  </div>
</template>

<script>
  export default {
    name: "CommonMediaObject",
    data() {
      return {
        media_left: 24,
        media_right: 0,

      }
    },
    props: {
      msg: {
        type: Object,
      }
    },
    created() {
      if (this.msg.img === '' || this.msg.img === null) {
        this.media_left = 24;
        this.media_right = 0;
      }else {
        this.media_left = 17;
        this.media_right = 7;
      }
    },
  }
</script>

<style scoped lang="less">


  .main-media-body {
    margin-top: 25px;
    margin-left: 35px;
  }
  .el-divider {
    margin-left: 35px;
    width: 95%;
  }
  .main-media-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.5;
  }

  .main-media-content {
    font-size: 13px;
    line-height: 24px;
    color: #999;
  }

  .main-media-status {
    margin-top: 10px;
    margin-bottom: -10px;
    font-size: 13px;
    font-weight: 400;
    line-height: 20px;
    color: #999;
    .el-icon-s-comment {
      margin-left: 10px;
    }
    .el-icon-star-on {
      margin-left: 10px;
    }
  }

  .media-img {
    border: #969696 1px solid;
    border-radius: 5px;
    margin-left: 35px;
  }

</style>